<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #mask {
            margin: 100px;
            height: 200px;
            width: 300px;
            background: #CCC;
            perspective: 800px;
            transition: all 0.1s linear;
        }
    </style>
</head>

<body>
    <div id="mask"></div>
</body>
<script>
    let el = document.getElementById('mask');
    el.addEventListener("mousemove", (e) => {
        console.log('mousemove');
        el.style.transform = `perspective(600px) rotateX(${20 * (1 - (e.pageY - 100) / 200)}deg) rotateY(${20 * ((e.pageX - 300) / 200)}deg)`;
    })

</script>

</html>